Skip to content

Cache tailscale binary file#166

Merged
mpminardi merged 4 commits into
tailscale:mainfrom
palindrom615:main
Apr 9, 2025
Merged

Cache tailscale binary file#166
mpminardi merged 4 commits into
tailscale:mainfrom
palindrom615:main

Conversation

@palindrom615
Copy link
Copy Markdown
Contributor

@palindrom615 palindrom615 commented Apr 3, 2025

This PR adds caching for Tailscale binary downloads to improve workflow performance and reduce bandwidth usage.

Motivation

At our company, we've experienced occasional download failures when our GitHub Actions workflows run on slower network nodes. These intermittent failures disrupt our CI/CD pipelines and require manual intervention. By implementing caching, we can significantly reduce these failures and improve the reliability of our workflows.

Changes:

  • Added SHA256-based cache keys for Linux and Windows platforms
  • Separated checksum retrieval, caching, and download steps for better organization
  • Optimized the download process to only fetch files when not available in cache

This change is backward compatible and requires no configuration changes from users.

related issues: #87 #156

@twelsh-aw
Copy link
Copy Markdown
Contributor

ah yes, I think this is better approach accounting for inputs.sha256sum. I will close my duplicate PR

A few notes:

  • it would be nice to make this opt-in, with default to no-cache (at least for next version)
  • macOS would be nice to figure out too, but less concerned with building from source for network issues we have seen.

@mpminardi
Copy link
Copy Markdown
Member

Thanks for the contribution! As @twelsh-aw mentioned we'll want this to be opt-in for v3 (can copy what was done for the use-cache parameter in https://github.com/tailscale/github-action/pull/167/files)

…uilds

This commit introduces a new `use-cache` input to the Tailscale GitHub Action. When set to `true`, the action will attempt to restore/install Tailscale binaries from a GitHub Actions cache, rather than always downloading or rebuilding them. If the cache is a hit, the download/build steps are
skipped, reducing network flakes and speeding up workflows. The default `false` preserves the
original behavior, ensuring full backward compatibility.
@palindrom615
Copy link
Copy Markdown
Contributor Author

ah yes, I think this is better approach accounting for inputs.sha256sum. I will close my duplicate PR

A few notes:

  • it would be nice to make this opt-in, with default to no-cache (at least for next version)
  • macOS would be nice to figure out too, but less concerned with building from source for network issues we have seen.

thanks for notes! definitely better to opt-in.

I cherry-picked your commit. in macOS part, I added commit hash for a cache key. please take a look!
@twelsh-aw @mpminardi

Comment thread action.yml Outdated
…i after installation

Co-authored-by: Mario Minardi <mminardi@shaw.ca>
@palindrom615 palindrom615 requested a review from mpminardi April 7, 2025 00:07
mpminardi added a commit that referenced this pull request Apr 8, 2025
Document the `use-cache` input added in #166

Updates: #87

Signed-off-by: Mario Minardi <mario@tailscale.com>
@mpminardi
Copy link
Copy Markdown
Member

@palindrom615 @twelsh-aw thank you both again for the contributions on this! Will be getting this into a release shortly.

mpminardi added a commit that referenced this pull request Apr 9, 2025
Document the `use-cache` input added in #166

Updates: #87

Signed-off-by: Mario Minardi <mario@tailscale.com>
@mpminardi mpminardi merged commit 32856f8 into tailscale:main Apr 9, 2025
mpminardi added a commit that referenced this pull request Apr 9, 2025
Document the `use-cache` input added in #166

Updates: #87

Signed-off-by: Mario Minardi <mario@tailscale.com>
@matanbaruch matanbaruch mentioned this pull request May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants